#!/bin/bash 
# SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.

# SPDX-License-Identifier: GPL-2.0-only

# create the db user fosstester for use during the tests

# first check that postgres is running
su postgres -c 'echo \\q|psql'
if [ $? != 0 ]; then
   echo "ERROR: postgresql isn't running"
   exit 1
fi
echo "*** Creating database user fosstester ***"

su postgres -c "psql < createDbUser.sql 2>&1" | grep -q exists
if [ $? == 0 ] ; then
   echo "OK, Database User 'fosstester' exists"
   exit 0
fi